<?php
function openConnection() {
	$connectDB = mysql_connect("localhost", "root", "");
	$selectDB = mysql_select_db("Advertisement", $connectDB);
	mysql_set_charset("utf8");
	if (!$connectDB || !$selectDB) {
		die('Could not connect:' . mysql_error());
		return null;
	} else {
		return $connectDB;
	}
}

function callSP($SP) {
	
	$xhr = openConnection();
	if ($xhr != null) {
		$result = mysql_query("call " . $SP);
		mysql_close();
		return $result;
	} else {
		mysql_close();
		return null;
	}
}

?>